package com.vitalfit.mapper;


import com.vitalfit.enums.FitnessPlanTypeEnum;
import com.vitalfit.enums.OrderStateEnum;
import com.vitalfit.model.dto.FitnessPlanDTO;
import com.vitalfit.model.entity.fitness.FitnessPlan;
import com.vitalfit.model.entity.user.Customer;
import com.vitalfit.model.vo.FitnessPlanVO;
import org.mapstruct.Context;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface FitnessPlanMapper {

    FitnessPlanMapper INSTANCE = Mappers.getMapper(FitnessPlanMapper.class);

    @Mapping(target = "customer", expression = "java(customer)")
    @Mapping(target = "planType", expression = "java(fitnessPlanTypeEnum.getFitnessPlanByPlanName(fitnessPlanDTO.getPlanType()))")
    @Mapping(target = "orderStateEnum",expression = "java(orderStateEnum)")
    FitnessPlan fitnessPlanDTOToFitnessPlan(FitnessPlanDTO fitnessPlanDTO,
                                            @Context Customer customer,
                                            @Context FitnessPlanTypeEnum fitnessPlanTypeEnum,
                                            @Context OrderStateEnum orderStateEnum);

    @Mapping(target = "planName", expression = "java(fitnessPlan.getPlanType().getPlanName())")
    FitnessPlanVO fitnessPlanToFitnessPlanVO(FitnessPlan fitnessPlan);

}
